package cn.fenqing.demo.demo.service.impl;

import cn.fenqing.demo.demo.service.IUserService;
import cn.fenqing.validation.annotation.ActivateValidation;
import cn.fenqing.validation.bean.group.Add;
import cn.fenqing.validation.bean.group.Update;
import org.springframework.stereotype.Service;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;

/**
 * @author fenqing
 * @version 0.0.1
 * @date 2021/7/6 17:06
 * @description
 */
@Service
//@ActivateValidation(group = Update.class)
public class UserServiceImpl implements IUserService {

//    @ActivateValidation(group = Add.class)
    @Override
    public void save(@Null(groups = Update.class, message = "用户名只能为空") String username, @NotNull(groups = Update.class, message = "密码不能为空") String password) {
        System.out.println(username);
    }

//    @ActivateValidation(group = Update.class)
    @Override
    public void save2(@Null(groups = Update.class, message = "用户名只能为空") String username, @NotNull(groups = Update.class, message = "密码不能为空") String password) {
        System.out.println(username);
    }
}
